<?php defined('_JEXEC') or die('Restricted access'); ?>

<h1> <?php echo JText::_('COM_PQCE_CATS');?> </h1>
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'ID' ); ?>
			</th>
			<th width="20">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->ctgrias ); ?>);" />
			</th>			
			<th width="50"> <?php echo JText::_('COM_PQCE_SHORTDESC');?>
			</th>
		<th width="300"> <?php echo JText::_('COM_PQCE_LONGDESC');?>
			</th>
		<th width="25"> <?php echo JText::_('COM_PQCE_SMALLIMG');?></th>
		<th width="20"> <?php echo JText::_('COM_PQCE_ACTF');?>
			</th>

		</tr>
	</thead>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->ctgrias ); $i < $n; $i++)	{
		$row = &$this->ctgrias[$i];
		$checked 	= JHTML::_('grid.id',   $i, $row->id );
		$link 		= JRoute::_( 'index.php?option=com_pqce&task=editCategory&cid[]='. $row->id );
		$linkA 		= JRoute::_( 'index.php?option=com_pqce&task=toggleActive&active='. (int)(1-$row->active). '&cid[]='. $row->id );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<?php echo $row->id; ?>
			</td>
			<td>
				<?php echo $checked; ?>
			</td>
			<td>
				<a href="<?php echo $link; ?>"><?php echo $row->short_desc; ?></a>
			</td>
			<td>
				<a href="<?php echo $link; ?>"><?php echo $row->long_desc; ?></a>
			</td>
			<td>
				<img src="<?php echo JURI::root().$row->short_desc_image; ?>" width="50" height="50"/>
			</td>
			<td>
				<a href="<?php echo $linkA.'&'.JUtility::getToken().'=1';?>"><?php echo ($row->active==1)? JText::_( 'COM_PQCE_YES' ): JText::_( 'COM_PQCE_NO' );?></a>
			</td>
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</table>
</div>

<input type="hidden" name="option" value="com_pqce" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</form>
